//
//  UIView+PopView.m
//  TongGuanLease
//
//  Created by 张奇 on 2022/5/5.
//

#import "UIView+PopView.h"
#import <objc/runtime.h>
#import "LDBottomPopView.h"

static const void *popViewKey = &popViewKey;
@implementation UIView (PopView)

- (void)tgShow {
    LDBottomPopView *popView = objc_getAssociatedObject(self, popViewKey);
    if (popView == nil) {
        popView = [[LDBottomPopView alloc] initWithContentView:self];
        objc_setAssociatedObject(self, popViewKey, popView, OBJC_ASSOCIATION_RETAIN);
    }
    [popView show];
}

- (void)tgHide {
    LDBottomPopView *popView = objc_getAssociatedObject(self, popViewKey);
    if (popView != nil) {
        [popView hide];
    }
}

@end
